<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<title>专利协同服务平台</title>
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/css/H-ui.css" />
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/css/iconfont.min.css" />
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/css/pantentlist/reset.css" />
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/css/pantentlist/body.css" />
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/css/wangEditor.min.css" />
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/css/pantentlist/main.css" />
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/css/pantentlist/pantentlist.css">

<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/jquery/jquery.min.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/H-ui.js"></script>
<script type="text/javascript"
	src="https://unpkg.com/wangeditor@3.1.1/release/wangEditor.min.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/jquery.validate-1.13.1.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/additional-methods.min.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/messages_zh.min.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/layer.js"></script>

<script type="text/javascript">
	//富文本编译器
	var MyUE = null;
	//多文件上传
	$(function() {
		$("#addFile")
				.click(
						function() {
							var i = $(".fileindex").length + 1;
							$(this)
									.parent()
									.parent()
									.before(
											"<div class='row cl fileindex'>"
													+ "<label class='form-label col-xs-3'>附件"
													+ i
													+ "：</label>"
													+ "<div class='formControls col-xs-8'>"
													+ "<span class='btn-upload form-group'>"
													+ "<input class='input-text upload-url' type='text' name='uploadfile-2' id='uploadfile-2' readonly style='width:200px'>"
													+ "<a href='javascript:void();' class='btn btn-primary upload-btn'>"
													+ "<i class='Hui-iconfont'>&#xe642;</i> 浏览文件</a>"
													+ "<input type='file'  id='uploadfiles' name='uploadfiles' class='input-file' style='width:100px;'>"
													+ "</span>"
													+ "<input type='button' style='margin-left:30px;' id='delete"
													+ i
													+ "'class='btn btn-primary'  onclick='deleteDiv("
													+ i + ")' value='删除'/>"
													+ "</div>" + "</div>");
						});
	});//end jquery 
	//删除附件节点
	function deleteDiv(i) {
		var $div = $("#delete" + i).parent().parent();
		$div.remove(); //删除当前元素
		//对file重写排序
		$(".fileindex").each(
				function(index) { //遍历所有的file
					var n = index + 1;
					$(this).find(":first").text("附件" + n);
					$(this).find("div:first span").find("input[type='file']")
							.attr("name", "file" + n);
				});
	}//end method

	function closeLayer() {
		var index = parent.layer.getFrameIndex(window.name);
		window.parent.location.reload();
		parent.layer.close(index);
	}
</script>
<style type="text/css">
.logo2 {
	margin-left: -40px;
	margin-top: -25px;
}
</style>
</head>
<body>
	<div id="contain" class="c_contain">
		<div id="top" class="c_top" style="background: #015AB8;">
			<!-- 标题文字 -->
			<img alt="logo2"
				src="${pageContext.request.contextPath}/images/index_logo2.png"
				class="logo2">
		</div>
		<div id="center" class="c_center">
			<div class="bd">
				<div class="main_body">
					<div class="tab_2_list">
						<ul>
							<li class="tab_first on">
								<div class="tab_top_on">
									<c:choose>
										<c:when test="${patent.sfApply == 1}">
											<p>&nbsp;修改专利交底书&nbsp;</p>
										</c:when>
										<c:when test="${patent.sfApply == 0}">
											<p>&nbsp;提交专利交底书&nbsp;</p>
										</c:when>
									</c:choose>
								</div>
							</li>

						</ul>
					</div>
					<div class="main_box">
						<div class="panel-body">
							<form
								action="${pageContext.request.contextPath}/patentApply/commitApply.action"
								method="post" enctype="multipart/form-data"
								class="form form-horizontal responsive" id="commitform">
								<input type="hidden" id="hidden" name="patentId"
									value="${patent.id}" />
								<div class="row cl">
									<label class="form-label col-xs-3">专利名称：</label>
									<div class="formControls col-xs-8">
										<input type="text" class="input-text" placeholder="请输入专利名称"
											name="patentName" id="validateParam" autocomplete="off"
											value="${patent.name}">
									</div>
								</div>
								<div class="row cl">
									<label class="form-label col-xs-3">所属技术领域：</label>
									<div class="formControls col-xs-8">
										<textarea id="validateParam" cols="" rows="" class="textarea"
											name="techfield" id="techfield"
											placeholder="写明要求保护的技术方案所属的技术领域，应当是所属或直接应用的具体技术领域，而不是上位的或者相邻的技术领域，也不是发明或者实用新型本身"
											style="width: 100%; height: 180px;">${patentApply.techfield}</textarea>
									</div>
								</div>
								<div class="row cl">
									<label class="form-label col-xs-3">背景技术：</label>
									<div class="formControls col-xs-8">
										<textarea id="validateParam" cols="" rows="" class="textarea"
											name="techbackground" id="techbackground"
											placeholder="应当写明对发明或者实用新型的理解、检索、审查有用的背景技术，并且引证反映这些背景技术的文件。尤其要引证包含发明或者实用新型专利申请最接近的现有技术文件。此外，还要客观地指出背景技术中存在的问题和缺点，但是，仅限于涉及由发明或者实用新型的技术方案所解决的问题和缺点。在可能的情况下，说明存在这种问题和缺点的原因以及解决这些问题时曾经遇到的困难。"
											style="width: 100%; height: 180px;">${patentApply.techbackground}</textarea>
									</div>
								</div>
								<div class="row cl">
									<label class="form-label col-xs-3">所要解决的技术问题：</label>
									<div class="formControls col-xs-8">
										<textarea id="validateParam" cols="" rows="" class="textarea"
											name="techquestion" id="techquestion"
											placeholder="针对现有技术中存在的缺陷和不足,用正面的、尽可能简洁的语言客观而有根据地反映发明或实用新型要解决的技术问题，也可以进一步说明其效果，但是描述语言不得采用广告式的宣传用语。"
											style="width: 100%; height: 180px;">${patentApply.techquestion}</textarea>
									</div>
								</div>
								<div class="row cl">
									<label class="form-label col-xs-3">具体技术方案：</label>
									<div class="formControls col-xs-8">
										<textarea id="validateParam" cols="" rows="" class="textarea"
											name="techmethod" id="techmethod"
											placeholder="一件发明或者实用新型专利申请的核心是其在说明书中公开的技术方案。技术方案是申请人对其要解决的技术问题所采取的技术措施的集合。该技术方案通常是由技术特征来体现的。专利法实施细则第十八条第一款第三项所说的写明发明或者实用新型解决其技术问题所采用的技术方案是指清楚、完整地描述发明或者实用新型所采取的技术方案的技术特征。"
											style="width: 100%; height: 180px;">${patentApply.techmethod}</textarea>
									</div>
								</div>
								<div class="row cl">
									<label class="form-label col-xs-3">与以往技术相比的有益效果：</label>
									<div class="formControls col-xs-8">
										<textarea id="validateParam" cols="" rows="" class="textarea"
											name="techeffect" id="techeffect"
											placeholder="清楚、客观地写明发明或者实用新型与现有技术相比所具有的有益效果。有益效果是指由构成发明或者实用新型的技术特征直接带来的、或者是由所述的技术特征必然产生的技术效果。有益效果是确定发明是否具有“显著的进步”，实用新型是否具有“进步”的重要依据。"
											style="width: 100%; height: 180px;">${patentApply.techeffect}</textarea>
									</div>
								</div>
								<div class="row cl">
									<span
										style="display: block; width: 750px; height: 50px; margin-left: 340px;">
										注:附图的作用在于用图形补充说明书文字部分的描述，使人能够直观地、形象化地理解发明或者实用新型的每个技术特征和整体技术方案。对于机械和电学技术领域中的专利申请，附图的作用尤其明显，实用新型必须有附图，发明申请可以有附图。</span>
									<span id="errorMsg"></span> <label class="form-label col-xs-3">附图及简要说明：</label>
									<input type="hidden" id="pictexplain" name="pictexplain" />
									<div class="formControls col-xs-8">
										<div id="editor">附图及简要说明</div>
										<script>
											var E = window.wangEditor;
											var editor = new E('#editor'); // 或者 var
											editor = new E(document
													.getElementById('editor'));	
											editor.customConfig.debug = true;
											editor.customConfig.uploadImgServer = '${pageContext.request.contextPath}/file/upload.action'
												editor.customConfig.uploadFileName = 'imgs'
											editor.create();			
											editor.txt.html('${patentApply.pictexplain}')

										</script>
									</div>
								</div>
								<div class="tips_box" style="margin-left: 240px;">
									<span id="tips"><img alt="warn"
										src="../images/warning.jpg">
										&nbsp;&nbsp;提示：点击"新增附件"按钮附加上传文件的输入框 </span>
								</div>
								<div class="row cl fileindex">
									<label class="form-label col-xs-3">附件1：</label>
									<div class="formControls col-xs-8">
										<span class="btn-upload form-group"> <input
											class="input-text upload-url" type="text" name="uploadfile-2"
											id="uploadfile-2" readonly style="width: 200px"> <a
											href="javascript:void();" class="btn btn-primary upload-btn"><i
												class="Hui-iconfont">&#xe642;</i> 浏览文件</a> <input type="file"
											id="uploadfiles" name="uploadfiles" class="input-file">
										</span>
									</div>
								</div>
								<div class="row cl">
									<div class="col-xs-8 col-xs-offset-3"
										style="width: 100px; float: left;">
										<input id="addFile" class="btn btn-primary" type="button"
											value="新增附件">
									</div>
									<div class="col-xs-8 col-xs-offset-3"
										style="width: 100px; float: left; margin-left: 10px;">
										<input id="button" class="btn btn-primary" type="button"
											onclick="validateForm()"
											value="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;提交&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" />
									</div>
									<input class="btn btn-primary" style="margin-left: 77%;"
										onclick="closeLayer()" type="button"
										value="&nbsp;&nbsp;关闭&nbsp;&nbsp;">
								</div>
							</form>
						</div>
					</div>
				</div>
			</div>
		</div>
		<!-- center-->
		<div id="floor" class="c_floor"></div>
		<!-- floor-->
	</div>
	<script type="text/javascript">
		var flag = false;
		$(function() {
			flag = $("#commitform").validate();
			$("[id='validateParam']").each(function() {
				$(this).rules("add", {
					required : true,
				});
			});
		});
		function validateForm() {
			if (flag) {
				if (editor.txt.text() != "") {
					$("#errorMsg").html("");
					//alert(editor.txt.html() );
					$("#pictexplain").val(editor.txt.html());
					//alert( $("#commitform").serialize());
				$("#commitform").submit();
				} else {
					$("#errorMsg")
							.html(
									"<font color='red' size='2'>&nbsp;&nbsp;&nbsp;&nbsp;该文本框不可以为空，请输入</font>");
				}
			} else {
				$("#commitform").submit();

			}
		}
	</script>
</body>
</html>